package ids.dev.model;

import ids.dev.util.IDSStringUtil;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name = "ids_sys_user")
public class SysUser implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "id")
	@SequenceGenerator(allocationSize = 1, initialValue = 1, sequenceName = "sys_user_id_seq", name = "sys_user_id_seq")
	@GeneratedValue(generator = "sys_user_id_seq", strategy = GenerationType.SEQUENCE)
	private Integer id;

	@Column
	private String username = IDSStringUtil.STRING_EMPTY;

	@Column
	private String password = IDSStringUtil.STRING_EMPTY;

	@Column
	private String fullName = IDSStringUtil.STRING_EMPTY;

	@ManyToMany(mappedBy = "members", cascade=CascadeType.REMOVE)
	List<Group> groups;

	public SysUser() {

	}

	public SysUser(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

}
